//
// Created by xili on 2024/8/30 10:07.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int minimumCost(vector<int> &cost) {
        sort(cost.begin(), cost.end());
        int n = cost.size();
        int cnt = 0;
        int ans = 0;
        for (int i = n - 1; i >= 0; i--) {
            if (cnt++ % 3 == 0) {
                continue;
            }
            ans += cost[i];
        }
        return ans;
    }
};